package com.puman.beautyfarmcounselor.util.config;

import android.util.Log;

import com.puman.beautyfarmcounselor.util.MD5;
import com.puman.beautyfarmcounselor.util.MethedUtil;

/**
 * Created by puman on 15/7/21.
 */
public class RequestAddr {


    //访问服务器地址
//    private static String baseUrl = "http://122.226.199.116:9696/beautyfarm/";//测试
    private static String Ip = "http://116.228.60.178:9696/";
    private static String baseUrl = Ip + "beautyfarm/";//生产
    public static String imageUrl = Ip + "imagenotes/upload/image/";  //图片地址
    public static String webUrl = Ip + "imagenotes/upload/wap/";//网页地址


    // 加密字符串
    private static String timeStamp = "";
    private static String safeStr = "public_key=bf_mob_app&timestamp=" + timeStamp + "&sign=" + getSign() + "&";
    private static String secret_key;//私钥
    private static String public_key;//公钥


    public static String login = getUrl("employee/login/login");  //登录
    public static String homeResult = getUrl("employee/index/index_statistics");//首页顾问当月数据
    public static String homeFast = getUrl("employee/index/index_campagin_statistics");//首页快捷按钮数据
    public static String homeAdvertising = getUrl("employee/proMotion/getAdList");//首页广告

    public static String schedule = getUrl("employee/schedule/quening");//排班
    public static String preOrder = getUrl("employee/schedule/order_list");//预约


    //任务
    public static String taskList = getUrl("employee/campaign/activityList");//任务列表
    public static String taskMemberList = getUrl("employee/campaign/activityFollowList");//任务跟进列表

    //首页
    public static String yuanyu = getUrl("employee/campaign/getYuanyuRemind");//院余
    public static String birthday = getUrl("employee/campaign/getBirthdayRemind");//生日　
    public static String detail = getUrl("employee/campaign/consumerInfo");//客户详情
    public static String consumeRecord = getUrl("employee/campaign/orderInfo");//消费纪录
    public static String surplusRecord = getUrl("employee/employee/getFact");//院余纪录
    public static String backRecord = getUrl("employee/campaign/returnRecord");//院余纪录
    public static String lableLib = getUrl("employee/customer/getLabelList");//获取标签
    public static String addlable = getUrl("employee/customer/addLabel");//增加标签
    public static String editLable = getUrl("employee/customer/modifyLabel");//修改客户标签
    public static String feedNote = getUrl("employee/interaction/contact");//备注

    //设置
    public static String message = getUrl("employee/employee/messageList");//消费纪录
    public static String feedback = getUrl("employee/employee/feedBack");//意见反馈

    /**
     * 获取加密签名
     *
     * @return 加密后的签名
     */
    private static String getSign() {
        return MD5.getMD5ofStr("qzed_suj4+hzudl9zrqw9q" + "&"
                + "bf_mob_app" + "&" + timeStamp);
    }


    /**
     * @return 从1970年1月1日至今的秒数
     */
    private static Long getTimestamp() {
        return System.currentTimeMillis();
    }

    /**
     * 拼接Url
     *
     * @param relativeUrl 相对地址
     * @return
     */
    private static String getUrl(String relativeUrl) {
        timeStamp = getTimestamp().toString();
        return baseUrl + relativeUrl + "?" + "public_key=bf_mob_app&timestamp=" + timeStamp + "&sign=" + getSign() + "&";
    }
}
